import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { PetUtil } from "../info/PetUtil";
import { BaseItem } from "../../common/BaseItem";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { ECareer } from "../../../../../Message/Public/ECareer";
import { Language } from "../../../../../extend/language/Language";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
type int = number;
//class PetBwTypeRenderer
    
    export  class PetBwTypeRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            this._type = arg1["type"] as int;
            this._value = arg1["value"] as int;
            this._imgItem.source = PetUtil.getCareer(this._value) + ".png";
            this._isEnable = !(this._type == this._value);
            this.setTipData();
            return;
        }

        /* internal  */init(): void
        {
            this._imgItem = new BaseItem();
            this._imgItem.setSize(62, 62);
            this._imgItem.move(2, 2);
            this.addChild(this._imgItem);
            return;
        }

        public /* override */ set selected(arg1: Boolean)
        {
            super.selected = arg1;
            if (this._isEnable) 
            {
                if (arg1) 
                {
                    this._imgItem.filters = [FilterConst.itemChooseFilter];
                }
                else 
                {
                    this._imgItem.filters = [];
                }
            }
            else 
            {
                this._imgItem.filters = [FilterConst.colorFilter];
            }
            this._imgItem.drawNow();
            return;
        }

        /* internal  */setTipData(): void
        {
            var loc1=null;
            if (PetUtil.getCareer(this._value) != ECareer._ECareerPetPhysical) 
            {
                if (PetUtil.getCareer(this._value) != ECareer._ECareerPetMagic) 
                {
                    if (PetUtil.getCareer(this._value) == ECareer._ECareerPetPhysique) 
                    {
                        loc1 = Language.getString(54048);
                    }
                }
                else 
                {
                    loc1 = Language.getString(54047);
                }
            }
            else 
            {
                loc1 = Language.getString(54046);
            }
            toolTipData = "<textFormat leading=\'3\'>" + HTMLUtil.addColor(loc1, "#FFFFFF") + "</textFormat>";
            return;
        }

        /* internal */ /* var */_imgItem: BaseItem;

        /* internal */ /* var */_type: int;

        /* internal */ /* var */_value: int;

        /* internal */ /* var */_isEnable: Boolean;
    }
